package com.digitalchina.lxnsy.viewholder;

import android.view.ViewGroup;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.entity.RewardHistoryVO;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.viewholder
 * 创建人：郑皓
 * 创建时间：2018/5/18 10:58
 * 修改备注：
 * ================================================
 */
public class RewardHistoryHolder extends BaseViewHolder<RewardHistoryVO> {

    private TextView tvTime;
    private TextView tvTel;
    private TextView tvType;
    private TextView tvCoin;

    public RewardHistoryHolder(ViewGroup parent) {
        super(parent, R.layout.item_reward_history);
        tvTime = $(R.id.tv_time);
        tvTel = $(R.id.tv_tel);
        tvType = $(R.id.tv_type);
        tvCoin = $(R.id.tv_coin);
    }

    @Override
    public void setData(RewardHistoryVO data) {
        super.setData(data);

        tvTime.setText(data.getCreateTime().replace(" ", "\n"));
        tvTel.setText(data.getMobilePhone().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"));
        tvType.setText(data.getRedType().equals("0") ? "咨询打赏" : "直播打赏");
        tvCoin.setText(data.getMoney() + "农币");
    }
}
